/*
 * Copyright (c) 2010 Philip Foulkes <philip.foulkes@gmail.com>
 *
 * This file is free software and is made available under the 
 * terms of the GNU General Public License, version 2, or at your
 * option, any later version
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _MRP_LEAVE_ALL_H_
#define _MRP_LEAVE_ALL_H_

/**
*    LeaveAll state table
*/
#define MRP_LEAVE_ALL_STATE_MIN			65 // This needs to be set to the value of the first item in this list 
#define MRP_LEAVE_ALL_STATE_ACTIVE 		65
#define MRP_LEAVE_ALL_STATE_PASSIVE		66
#define MRP_LEAVE_ALL_STATE_MAX			66 // This needs to be set to the value of the last item in this list 
#define MRP_LEAVE_ALL_STATE_NO_CHANGE 	67 // This needs to be one more than the last itme in the list
#define MRP_LEAVE_ALL_STATE_NUM			(MRP_LEAVE_ALL_STATE_MAX - MRP_LEAVE_ALL_STATE_MIN + 1)

#include "mrp_state_machine.h"

/**
*   The LeaveAll state machine periodically ensures that Participants reregister
*   attributes, thus guarding against an extended failure to register or deregister.
*/
struct mrp_leave_all
{
    struct mrp_state_machine mrp_state_machine; /* this has to be the first member */
    
    struct timer_list leave_all_timer;
    
    struct mrp * mrp;
};

struct mrp_leave_all * mrp_leave_all_create_and_init(void);
void mrp_leave_all_destroy(struct mrp_leave_all ** mrp_leave_all);

int mrp_leave_all_set_mrp(struct mrp_leave_all * mrp_leave_all, struct mrp * mrp);

void mrp_leave_all_stop_leave_timer(struct mrp_leave_all * mrp_leave_all);

#endif
